home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / basic / vxbase.zip / VXFORM1.FRM (.txt) < prev    next >
Visual Basic Form  |  1992-03-07  |  23KB  |  479 lines

  1. VXFORM1
  2. 4vxBase Sample Application: Aircraft Brokerage System
  3. Form1
  4. Picture1
  5. DDDK0
  6. DKDK0
  7. DKDK0
  8. Label1
  9. vxBase Sample Application
  10. Tms Rmn
  11. FileMenu
  12. &File
  13.     OpenTypes
  14. &Types
  15. OpenCust
  16. &Customers
  17. OpenAircraft
  18.     &Aircraft
  19. SepBar
  20. ExitCode
  21. LinkMenu
  22. &Link
  23. LinkBuyToSell
  24. &Buyer to Sellers
  25. LinkSellToBuy
  26. &Seller to Buyers
  27.     MaintMenu
  28. &Maintenance
  29.     PackFiles
  30. &Pack
  31. TestMenu
  32. &Test
  33. TestCreate
  34. &Create
  35. TestCopy
  36. Copy &Structure
  37. TestDataCopy
  38. Copy &Data
  39.     FileStruc
  40. &File Structure
  41. RecStruc
  42. &Record Structure
  43. UMenu
  44. &User Browse Menus
  45. ExitCode_Click
  46. VXFORM1
  47. Form_Unload
  48. Cancel
  49. CanClose
  50. Form2Activew
  51. FALSE
  52. Form3Active
  53. Form4Active
  54. Form5Active
  55. Form6Active
  56. Form7ActiveL
  57. AircraftDbfo
  58. vxUseDbf=
  59. Aircraf1Ntx~
  60. vxUseNtx[
  61. Aircraf2Ntx
  62. AirbuyerDbfi
  63. Airbuy1Ntx
  64. Airbuy2Ntx
  65. vxCloseAll
  66. vxCtlGrayReset#
  67. vxDeallocate
  68. OpenTypes_Click
  69.     TypesOpenb
  70. BrowseTypes
  71. OpenCust_Click
  72. AircustDbf
  73. Aircust1Ntx
  74. Aircust2Ntx
  75. Aircust3Ntx5
  76. vxTableDeclare
  77. VX_BLUEP
  78. vxTableFieldj
  79. VX_FIELD&
  80. StatesOpen
  81. vxSelectDbfS
  82. vxSelectNtx
  83. BrowseCust
  84. OpenAircraft_Click
  85. AircraftOpenH
  86.     BrowseAirx
  87. LinkBuyToSell_Click7
  88. VX_EXPR
  89. vxClose
  90. VX_RED
  91. vxJoinU
  92. OpenCust
  93. Enabled
  94. LinkBuyToSell
  95. LinkSellToBuy
  96.     PackFiles=
  97. vxBrowse
  98. hWndq
  99. BuyerReturn
  100. LinkSellToBuy_Click
  101. AircraftReturnr
  102. TestCreate_Click
  103. TypeFile
  104.     FileStruc
  105.     NumFieldsF
  106. NewRet
  107.     OpenTypes
  108. TestCreate
  109. TestCopy.
  110. TestDataCopy
  111. Fld01
  112. Fld02
  113. vxCreateDbf)
  114. TypeDbf
  115. TypeNtx
  116. vxCreateNtx
  117. vxAppendFrom
  118. PackFiles_Click
  119.     vxAreaDbfa
  120. AirtypesDbf
  121. AirtypesNtx:
  122. vxPack
  123. TestCopy_Click
  124. NtxExpr
  125.     vxNtxExprH
  126. vxCopyStrucQ
  127. TestDataCopy_Click
  128. vxCopy^
  129. StartRec
  130. EndRecQ
  131. vxDeleteRange
  132. vxUnlock
  133. NtxName
  134.     vxNtxName
  135. FileStruc_Click
  136. VXFORM7+
  137. Form_Paint
  138. vxFormFrame
  139. Form_Click
  140. OpenAircraft
  141. RecStruc_Click
  142. VXFORM8
  143. UMenu_Click
  144. vxMenuDeclare:
  145. vxMenuItem
  146. VX_MENUHEAD
  147.     VX_RETURN
  148.     VX_SEPBAR
  149. vxBrowsePos
  150. TypeReturn
  151. UMenu
  152. vxCtlGraySet
  153. LinkMenu_Click
  154. ExitCode_Click
  155.  The master form VXFORM1 is unloaded.-
  156.  The Form_Unload procedure does thed
  157.  final cleanup.d
  158. Form_Unload
  159.  This routine is activated from either the
  160.  Exit menu item on VXFORM1 or by selecting
  161.  the Close item from the system menu.c
  162.  We MUST test the vxCloseAll result in
  163.  case there are any active browse windowsg
  164.  that require closure before we cani
  165.  terminate the application
  166.  If the close operation is successful, any
  167.  open databases FOR THIS TASK are closed
  168.  (which updates the database header information)
  169.  and all attached memory objects (Tables and Joins)-
  170.  are released.
  171.  if any of our other forms are active, we-
  172.  cannot close this form and exit the app
  173. Sub forms must be closed first
  174.  redraw top level form
  175.  NOTE: we cannot use the FORM.Visible property to-
  176.  check if any forms are active because as soon as-
  177.  we reference a form, it gets loaded - and our app
  178.  will stall with No Database messages because as soon
  179.  as the form is loaded, the database attached to that
  180.  form is referencedd
  181.  test vxcloseall with some files open-
  182. \vb\vxbtest\aircraft.dbf
  183. \vb\vxbtest\aircraf1.ntx
  184. \vb\vxbtest\aircraf2.ntx
  185. \vb\vxbtest\airbuyer.dbf
  186. \vb\vxbtest\airbuy1.ntx"
  187. \vb\vxbtest\airbuy2.ntx"
  188.  redraw top level form
  189.  if this is master vxbase task and other
  190.  vxbase tasks are active then we can't exite
  191.          Exit Sub
  192.  reset system disabled color
  193. OpenTypes_Click
  194.  in VXBMOD.BAS
  195.  start browse tableS
  196.  in module file VXBMOD.BAS
  197. OpenCust_Click
  198.  open brokerage customers file
  199. \vb\vxbtest\aircust.dbf"
  200. Error Opening aircust.dbf. Aborting.
  201. \vb\vxbtest\aircust1.ntx
  202. \vb\vxbtest\aircust2.ntx
  203. \vb\vxbtest\aircust3.ntx
  204.  Declare Customer Tablen
  205. a_code
  206. a_name
  207. a_city
  208. State"
  209. a_state"
  210. Res Phone"
  211. a_phoneres
  212. Bus Phone"
  213. a_phonebus
  214.  open state abbreviations file
  215.  in VXBMOD.BAS
  216.  start browse tableS
  217.  in module VXMOD.BAS
  218. OpenAircraft_Click
  219.  both routines in VXBMOD.BAS
  220. LinkBuyToSell_Click
  221.  Demonstration of setting up visual relationships-
  222.  with the vxJoin command. What we have is a file of buyers
  223.  categorized by type of aircraft they are interested in.
  224.  What we are going to do is display a browse table ofi
  225.  these buyer records and link any buyer record toe
  226.  another browse table of aircraft that match the the
  227.  buyer aircraft type field.r
  228.  Conversely, the LinkSellToBuy proc does the opposite. It
  229.  links the aircraft with all prospective buyers.
  230.  open file that will control the join-
  231. \vb\vxbtest\airbuyer.dbf
  232. \vb\vxbtest\airbuy2.ntx"
  233.  this index is on aircraft type
  234.  define table to show data we are interested in-
  235. b_cat"
  236. Description"
  237. left(b_desc,20)"
  238. b_low"
  239. b_high
  240. Customer
  241. b_code
  242.  now open secondary file and define its table
  243. \vb\vxbtest\aircraft.dbf
  244. Error Opening aircraft.dbf. Aborting."
  245. \vb\vxbtest\aircraf2.ntx
  246.  on type
  247. c_cat"
  248. c_code
  249. Price"
  250. c_price"
  251. c_year
  252. c_ttsn
  253.  reselect the master file and set up the join 
  254. b_cat"
  255. Possible Sales#
  256.  this joins the Aircraft file using the index selected for
  257.  it to the buyer file. The "b_cat" param is the field we
  258.  will use as a key into the aircraft file and the VX_FIELD
  259.  item tells vxBase that it is a field and not an expression.
  260.  The last item in the call is a title for the join window.
  261.  disable menu items that might affect our display-
  262.  now set up and execute the browse. The JOIN menu item is-
  263.  automatically enabled. 
  264. Buyer Details"
  265.  when we return from the browse we can ignore anything
  266.  vxBase sent back to us in the BuyerReturn param
  267.  we could get fancy and get the customer record if the
  268.  use hit enter and then display or edit it. Do
  269.  whatever you like.t
  270.  re-enable menu items-
  271. LinkSellToBuy_Click
  272.  Browse the aircraft for sale file and join to
  273.  potential buyers. See a more detailed explanantion of
  274.  visual relationships in the LinkBuyToSell Proct
  275.  open file that will control the join-
  276. \vb\vxbtest\aircraft.dbf
  277. Error Opening aircraft.dbf. Aborting."
  278. \vb\vxbtest\aircraf2.ntx
  279.  on type
  280.  define table to show data we are interested iny
  281. c_cat"
  282. Description"
  283. left(c_desc,20)"
  284. c_code
  285. Price"
  286. c_price"
  287. c_year
  288. c_ttsn
  289.  now open secondary file and define its table
  290. \vb\vxbtest\airbuyer.dbf
  291. Error Opening airbuyer.dbf. Aborting."
  292. \vb\vxbtest\airbuy2.ntx"
  293. b_cat"
  294. b_low"
  295. b_high
  296. Customer
  297. b_code
  298.  reselect the master file and set up the join
  299. c_cat"
  300. Possible Buyers"#
  301.  this joins the buyer file using the index selected for
  302.  it to the aircraft file. The "c_cat" param is the field we
  303.  will use as a key into the buyer file and the VX_FIELDd
  304.  item tells vxBase that it is a field and not an expression.
  305.  The last item in the call is a title for the join window.
  306.  disable menu items-
  307.  now set up and execute the browse. The JOIN menu item is-
  308.  automatically enabled. 
  309. Aircraft Record Display"
  310.  when we return from the browse we can ignore anything
  311.  vxBase sent back to us in the BuyerReturn param
  312.  re-enable menu items-
  313. TestCreate_Click
  314.  1234567890123456  (ruler to help alignment)
  315. CATEGORY  C  3 0
  316. CATNAME   C 15 0
  317.  our field length for the second field is shorter-
  318.  than the original file so when we appendfrom below
  319.  this field should be truncated and will show as
  320.  such in the browseb
  321. \vb\vxbtest\typefile.dbf
  322. Error in database creation
  323. \vb\vxbtest\typefile.dbf
  324.  index create opens and selects new index and
  325.  returns the index select area. Zero (FALSE)
  326.  is returned if there was an error
  327. \vb\vxbtest\typefile.ntx
  328. category
  329. Error in index create"
  330. \vb\vxbtest\airtypes.dbf
  331. Error in append from
  332. New File
  333. \vb\vxbtest\typefile.dbf
  334. \vb\vxbtest\typefile.ntx
  335. PackFiles_Click
  336.  removes logically deleted records
  337.  and reindexes
  338. \vb\vxbtest\airtypes.dbf
  339. airtypes in use!
  340. \vb\vxbtest\airtypes.dbf
  341. \vb\vxbtest\airtypes.ntx
  342. \vb\vxbtest\aircust.dbf"
  343. aircust in use!"
  344. \vb\vxbtest\aircust.dbf"
  345. \vb\vxbtest\aircust1.ntx
  346. \vb\vxbtest\aircust2.ntx
  347. \vb\vxbtest\aircust3.ntx
  348. \vb\vxbtest\airbuyer.dbf
  349. airbuyer in use!
  350. \vb\vxbtest\airbuyer.dbf
  351. \vb\vxbtest\airbuy1.ntx"
  352. \vb\vxbtest\airbuy2.ntx"
  353. \vb\vxbtest\aircraft.dbf
  354. aircraft in use!
  355. \vb\vxbtest\aircraft.dbf
  356. \vb\vxbtest\aircraf1.ntx
  357. \vb\vxbtest\aircraf2.ntx
  358. TestCopy_Click
  359.  disable items that would be affected by
  360.  closure of airtypes file 
  361. \vb\vxbtest\airtypes.dbf
  362. \vb\vxbtest\airtypes.ntx
  363. \vb\vxbtest\testcopy.dbf
  364. Error in database copy struc
  365. \vb\vxbtest\testcopy.dbf
  366.  index create opens and selects new index and-
  367.  returns the index select area. Zero (FALSE)
  368.  is returned if there was an error
  369. \vb\vxbtest\testcopy.ntx
  370. Error in index create"
  371. \vb\vxbtest\airtypes.dbf
  372. Error in append from
  373. New File
  374. \vb\vxbtest\testcopy.dbf
  375. \vb\vxbtest\testcopy.ntx
  376. TestDataCopy_Click
  377. \vb\vxbtest\airtypes.dbf
  378. \vb\vxbtest\airtypes.ntx
  379. \vb\vxbtest\testdata.dbf
  380. Error in database copy
  381. \vb\vxbtest\testdata.dbf
  382.  Test delete range
  383. Error in DeleteRange
  384.  index create opens and selects new index and
  385.  returns the index select area. Zero (FALSE)
  386.  is returned if there was an error
  387. \vb\vxbtest\testdata.ntx
  388. Error in index create"
  389.  test ntx name function"
  390. \vb\vxbtest\testdata.dbf
  391. \vb\vxbtest\testdata.ntx
  392. FileStruc_Click
  393.  disable items that would be affected by
  394.  closing of aircust file
  395. Form_Paint
  396. Form_Click
  397.  test for active forms and set
  398.  menu items accordingly. We do this here
  399.  as well as when we start up our forms
  400.  because some functions allow otherr
  401.  functions to be active and when one or
  402.  the other is closed and menu items are
  403.  re-enabled, then we mess up our menur
  404.  disabling for the ones left open.
  405. RecStruc_Click
  406. \vb\vxbtest\airtypes.dbf
  407. Error Opening airtypes.dbf. Aborting."
  408. \vb\vxbtest\airtypes.ntx
  409. Error Opening airtypes.ntx. Aborting."
  410. UMenu_Click
  411.  this proc shows how to set up user defined
  412.  menus on a browse window and also how toe
  413.  define the browse window initial position
  414.  Open aircraft types file-
  415. \vb\vxbtest\airtypes.dbf
  416. Error Opening airtypes.dbf. Aborting."
  417. \vb\vxbtest\airtypes.ntx
  418. Error Opening airtypes.ntx. Aborting."
  419.  Declare types table
  420. category
  421. Description"
  422. catname"
  423.  Declare and build a user menu
  424.  19 items in the menu
  425.  the menu item params are:
  426.    (1) menu index number (from 1 to whatever was declared)
  427.    (2) attach this item to submenu number where 0 is the
  428.  top level browse menu and any other number must
  429.  refer to a menu index that was defined as VX_MENUHEAD
  430.    (3) the menu string. An ampersand in front of a character
  431.  will make that character the mnemonic. If a VX_SEPBAR
  432.  is being defined, pass a space " "n
  433.    (4) the menu item type as defined in the global module
  434.  where VX_MENUHEAD is a submenu header,h
  435.  VX_SEPBAR   is a separator bar, and
  436.  VX_RETURN   is a returnable itema
  437.  If any item is selected from the browse that is defined
  438.  as VX_RETURN, the RetVal parameter passed to vxBrowse
  439.  will contain the value of the menu index number plus 100
  440.  and negated (e.g., menu item 6 below will return -106).
  441.  The record pointer will be positioned at the record that
  442.  was highlighted when the return was made. If the user
  443.  presses the ENTER key in the browse, the RetVal willr
  444.  contain the record number that was highlighted when ENTER
  445.  was pressed.r
  446.  the first menu item will set up a submenu on theh
  447.  browse table top level menu (Attach to item 0)h
  448. &File"
  449.  the item above is attached to the submenu defined as item 1
  450. &Open"
  451. &Save"
  452.  the item above creates another submenu within the File menu
  453. &New Name"
  454.  the items above are under the sub menu defined as item 4)
  455. &Print
  456. E&xit"
  457.  now we'll set up another menu on the top level browse menu
  458. &Edit"
  459.  and attach items to menu number 11 below it
  460. &Copy"
  461. &Paste
  462. Cl&ear
  463. &Delete"
  464.  The proc below will set up an initial position 
  465.  for the browse window
  466.  the coordinates are in familiar character and linew
  467.  units. The first param is x (characters in from left),m
  468.  the second param is y (lines down from top), the thirdm
  469.  param is the width of the window in characters, and the
  470.  last param is the window height in linesa
  471.  if the user movers or sizes the window, and subsequente
  472.  vxBrowse calls are made with an intervening close of the
  473.  file, the window will retain its last position and size.
  474.  now we set up the browset
  475. Aircraft Types
  476.  Note that the EDIT menu parameter should be FALSE if you
  477.  are defining your own menus.m
  478. Value returned from browse was "
  479.